package app;

import java.awt.List;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.UUID;

import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture;

public class Test {
	
	private Integer probando;
	private Integer probando2;
	private Integer probando3;
	
	   public static void main( String[] args )
	   {
	      System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
	      Mat mat = Mat.eye( 3, 3, CvType.CV_8UC1 );
	      System.out.println( "mat = " + mat.dump() );
	   }
	   
	   public void VideoCaptureWithOpenCV()
	   {
		   
		   ArrayList<Object[]> lista = new ArrayList<Object[]>();
		   for(Object[] a: lista) 
		   {
		     System.load(new File("PatioUadeMartes5.MOV").getAbsolutePath());
		     VideoCapture videocapture = new VideoCapture(0);
		     assert(videocapture.isOpened());
		     while (videocapture.grab()) 
		     {
		       Mat image = new Mat();
		       while (videocapture.read(image) == false) 
		       {
		    	   System.out.println("waiting for successful grab");
		       }
		       String fn = "image_%s.png".format(UUID.randomUUID().toString());
		       Highgui.imwrite(fn, image);
		       System.out.println("grabando..");
		     }
		     System.out.println("now you have many photos of yourself :)");
		   }
		   
		 }

}
